const path = require("path");
module.exports = {
    lintOnSave: false,
    publicPath: "./",
    // 输出文件目录
    outputDir: "dist",
    // eslint-loader 是否在保存的时候检查
    // 是否使用包含运行时编译器的 Vue 构建版本
    runtimeCompiler: false,
    // 生产环境是否生成 sourceMap 文件
    productionSourceMap: false,
    // 生成的 HTML 中的 <link rel="stylesheet"> 和 <script> 标签上启用 Subresource Integrity (SRI)
    integrity: false,
    css: {
        sourceMap: true,
        loaderOptions: {
            postcss: {
                plugins: [
                    require("postcss-plugin-px2rem")({
                        rootValue: 100, // 新版本的是这个值
                        mediaQuery: true, //（布尔值）允许在媒体查询中转换px。
                        minPixelValue: 3, //设置要替换的最小像素值(3px会被转rem)。 默认 0
                        exclude: /(src|assets|styles)/
                    })
                ]
            }
        }
    },
    devServer: {
        open: true,
        host: "0.0.0.0",
        port: 8080,
        https: false,
        hotOnly: false,
        // http 代理配置
        proxy: {
            "/api": {
                target: "http://api.apishop.net/",
                changeOrigin: true,
                pathRewrite: {
                    "^/api": ""
                }
            }
        }
    },
    pwa: {
        iconPaths: {
            favicon32: "favicon.ico",
            favicon16: "favicon.ico",
            appleTouchIcon: "favicon.ico",
            maskIcon: "favicon.ico",
            msTileImage: "favicon.ico"
        }
    },
    configureWebpack: {
        output: {
            sourcePrefix: " "
        },
        amd: {
            toUrlUndefined: true
        },
        resolve: {
            extensions: [".js", ".vue", ".json", "styl"],
            alias: {
                vue$: "vue/dist/vue.esm.js",
                "@": path.resolve("src"),
                images: path.resolve(__dirname, "src/assets/images"),
                styles: path.resolve(__dirname, "src/assets/styles"),
                static: path.resolve(__dirname, "static")
            }
        }
    }
};